/*
 * Copyright (C) 2011 Johan Kannala
 *
 * Licensed under the MIT License. You can find a copy of the License at in the
 * license.txt file.
 */
package com.joppe.vocabtutor;

import android.app.Application;
import android.util.Log;

/**
 * @author joppe
 * 
 */
public class VocabTutor extends Application {
	public static final String APP_NAME = "VocabTutor";
	
	private VocabTutorDBHelper dbHelper = null;

	   @Override
	   public void onCreate() {
	      super.onCreate();
	      Log.d(APP_NAME, "APPLICATION onCreate");
	      this.dbHelper = new VocabTutorDBHelper(this);      
	   }
	   
	   @Override
	   public void onTerminate() {
	      Log.d(APP_NAME, "APPLICATION onTerminate");
	      super.onTerminate();      
	   }

	   public VocabTutorDBHelper getDataHelper() {
	      return this.dbHelper;
	   }

	   public static String toCommaSeparatedString(long[] longArray) {
			if (longArray == null)
				return "()";
			if (longArray.length == 0)
				return "()";
			
			StringBuilder buf = new StringBuilder("(");
			for (int i = 0; i < longArray.length; i++) {
				if (i > 0)
					buf.append(',');
				buf.append(longArray[i]);
			}
			return buf.append(')').toString();
		}
}
